home *** CD-ROM | disk | FTP | other *** search
- Path: sunrise.gv.ssi1.com!news
- From: Mike Palmer <Mike.Palmer@tus.ssi1.com>
- Newsgroups: comp.lang.c++
- Subject: Re: How to shrink your Windows program by %80!
- Date: 5 Mar 1996 02:51:47 GMT
- Organization: Silicon Systems, Inc.
- Message-ID: <4hga83$65t@atlas.tus.ssi1.com>
- References: <4hau9d$m3@newsbf02.news.aol.com>
- NNTP-Posting-Host: pc259u.tus.ssi1.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 16bit)
-
- champalber@aol.com (Champalber) wrote:
- >How is that possable? Convert it to Pascal.
- >
- >Does anybody use Turbo Pascal (TP) for Windows? Having used only
- >BorlandC++ (BC) for Windows for the past few years, I was amazed to see
- >how much faster TP compiled and how much smaller the resulting code was.
- >If you have these two products try out a simple experiment: Write the
- >"hello world. program for Windows" with each compiler, then look and see.
- >
- >When I compiled with TP I thought that the compilation had stopped on an
- >error, but no, it was just _very_ fast. In my particular case I wrote a
- >very simple program to write a few lines of text in a window; a simple
- >task that I wanted to spend as little time writing as possible, so I used
- >OWL for BC, and the equivilent for TP.
-
- I used TP for DOS for a while, and generally found that the code produced
- was small, and the compiler was blindingly fast. I've still never seen
- anything like it in terms of speed.
-
- >
- >The size comparison: BC - 90k, TP - 14k!
- >The two programs do _exactly_ the same thing.
- >
- >What is surprising is that both compilers are written by Borland, and the
- >Windows stuff in Pascal is very similar to the C++ version - same Windows
- >functions, same sequence of functions.
- >
- >Why does one compiler seem to be so much more efficient than the other?
- >There is always the argument that "you get all the C++ goodies", but using
- >TP you can do just about everything that you can do in BC, with seamingly
- >increadable savings on final exe size.
- >
- >Richard Champalbert
- >champalber@aol.com
- >
-
- But, the reason I switched to C was that Pascal wanted to type things
- too strongly. Maybe I just never really understood Pascal, or how to
- get around the problems, but it seemed like I always found myself
- trying to pass a variable sized array into some function that would
- operate on the data. Pascal, however, always wanted me to pass in
- some kind of "Array of 1 to 500 of type X", which pretty much drove
- me nuts. For a data plotting program like I was trying to write, the
- size of the array was indeterminate, and would only be determined
- when the program was run. In many cases, the same function would be
- called with several different sized arrays during the course of one
- run. Like I said, maybe I never discovered the secret, but I read
- several books trying to find the answer, and could never find one
- that fully satisfied me.
-
- A second reason was that there was an accepted standard for C when I
- switched, and there was no widely accepted standard for Pascal. That
- meant that when I programmed on my workstation, it was a (significantly)
- different Pascal than on my PC. Boy did I ever wish that Borland had
- produced compilers for workstations!!!
-
- So, for me, C was a refreshing change, and C++ has enough advantages
- in its organizational structures that I have now switched to that.
-
- I don't really like the code bloat that I seem to be stuck with, but
- the coding advantages (at least for now) outweigh the problems.
-
- BUT: If Pascal works for you, go for it! Even though it didn't work
- for me, it was for some pretty specific reasons. Overall, I didn't
- mind the strong type checking in Pascal, and I never had the kind of
- memory and boundary problems that I have been plagued with in C
- ever since I switched.
-
- And, of course, thanks for making your files smaller - it leaves
- more room for my bloated C++ exe's :-) !!!
-
-
- -- Mike --
-
-